package com.shrct.businessprocess.purchase.impl;

import com.shrct.businessprocess.purchase.RCBasePurchaseOrder;
import com.shrct.businessprocess.purchase.RCOrderCommissionPayRequest;
import com.shrct.businessprocess.purchase.RCPurchaseOrderCommissionPayProcess;
import com.shrct.businessprocess.purchase.impl.RCBasePurchasePayRequestImpl;
import com.shrct.businessprocess.purchase.proxy.RCOrderCommissionPayRequestProxy;
import edu.fudan.langlab.domain.workflow.BusinessProcess;
import edu.fudan.mylang.pf.IGenericQuery;
import edu.fudan.mylang.pf.IObjectFactory;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCORDERCOMMISSIONPAYREQUEST_TYPE")
public class RCOrderCommissionPayRequestImpl extends RCBasePurchasePayRequestImpl implements RCOrderCommissionPayRequest {
  public RCOrderCommissionPayRequestImpl() {
    super();
  }
  
  public RCOrderCommissionPayRequestImpl(final RCBasePurchaseOrder purchaseOrder) {
    super( purchaseOrder);
    
  }
  
  private Double taxRate = Double.valueOf(0d);
  
  public Double getTaxRate() {
    return this.taxRate;
  }
  
  public RCOrderCommissionPayRequest setTaxRate(final Double taxRate) {
    this.taxRate = taxRate;
    return this;			
    
  }
  
  public String getEntityName() {
    RCBasePurchaseOrder _purchaseOrder = this.getPurchaseOrder();
    String _entityName = _purchaseOrder.getEntityName();
    String _plus = ("\u652F\u4ED8\u624B\u7EED\u8D39\uFF0C\u8BA2\u5355\u53F7:" + _entityName);
    return _plus;
  }
  
  public BusinessProcess getProcess() {
    IGenericQuery<RCPurchaseOrderCommissionPayProcess> query=getObjectFactory().createGenericQuery(RCPurchaseOrderCommissionPayProcess.class,"select e from com.shrct.businessprocess.purchase.impl.RCPurchaseOrderCommissionPayProcessImpl as e   where ((e.payRequest) = (:this)) and  e.active = 1      ").setParameter("this",this);
    RCPurchaseOrderCommissionPayProcess _uniqueResult = query.uniqueResult();
    return _uniqueResult;
  }
  
  public static RCOrderCommissionPayRequest create(final RCBasePurchaseOrder purchaseOrder, final IObjectFactory objectFactory) {
    com.shrct.businessprocess.purchase.RCOrderCommissionPayRequest rCOrderCommissionPayRequest = new com.shrct.businessprocess.purchase.impl.RCOrderCommissionPayRequestImpl(
    	purchaseOrder
    );
    objectFactory.create(rCOrderCommissionPayRequest);
    return rCOrderCommissionPayRequest;			
    
  }
  
  public static RCOrderCommissionPayRequest createRCOrderCommissionPayRequestImpl(final RCBasePurchaseOrder purchaseOrder, final IObjectFactory objectFactory, final Procedure1<RCOrderCommissionPayRequest> init) {
    com.shrct.businessprocess.purchase.RCOrderCommissionPayRequest rCOrderCommissionPayRequest = new com.shrct.businessprocess.purchase.impl.RCOrderCommissionPayRequestImpl(
    	purchaseOrder
    );
    objectFactory.create(rCOrderCommissionPayRequest);
    init.apply(rCOrderCommissionPayRequest);
    
    return rCOrderCommissionPayRequest;			
    
  }
  
  public RCOrderCommissionPayRequestProxy toProxy() {
    com.shrct.businessprocess.purchase.proxy.RCOrderCommissionPayRequestProxy proxy = new com.shrct.businessprocess.purchase.proxy.RCOrderCommissionPayRequestProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
